package Package.Example.Example1;

import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Example1 {
    public static final void Example1() throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Properties prop = new Properties();
        FileReader fr = new FileReader("D:\\insert\\a.txt");
        prop.load(fr);
        fr.close();
        String className=prop.getProperty("ClassName");
        String MethodsName=prop.getProperty("MethodsName");
        Class<?> c=Class.forName(className);
        Constructor<?> con=c.getConstructor();
        Object obj=con.newInstance();
        Method method = c.getMethod(MethodsName);
        method.invoke(obj);
    }
}
